<div class="chit-chat-layer1">
    <div class="col-md-12 chit-chat-layer1-left">
        <div class="mail-toolbar clearfix">
            <div class="float-left">
                <button type="button" class="btn btn-primary">添加新岗位</button>
                <div class="clearfix"></div>
            </div>
            <div class="float-right">
                <div class="btn-group m-r-sm mail-hidden-options" style="display: inline-block;">
                    <div class="btn-group">
                        <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">所有部门
                            <span class="caret"></span></a>
                        <ul class="dropdown-menu dropdown-menu-right" role="menu">
                            <li><a href="#">策划部门</a></li>
                            <li><a href="#">人事部门</a></li>
                            <li><a href="#">技术部门</a></li>
                        </ul>
                    </div>
                    <span class="text-muted m-r-sm" style="margin-left: 5px">
                        <button type="submit" class="btn btn-primary">查询</button>
                    </span>
                </div>
            </div>
        </div>
        <div class="work-progres" style="margin-top:40px;width: 1130px">
            <div class="chit-chat-heading">
                岗位信息
            </div>
            <div class="table-responsive">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>名称</th>
                    <th>所属部门</th>
                    <th>员工人数</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
            <tbody>
            <#if pageView?exists && pageView.records?size gt 0>
                <#list pageView.records as hrmPost>
                <tr>
                    <td class="hidden">${hrmPost.id?default("")}</td>
                    <td>
                        <span>${(pageView.pageNow - 1)*(pageView.pageSize)?default(20) + hrmPost_index + 1}</span>
                    </td>
                    <td>${hrmPost.name?default("")}</td>
                    <td>所属部门数据库原本没加</td>
                    <td>员工人数也不知道咋写</td>
                    <td>${hrmPost.remark?default("")}</td>
                    <td>
                        <button type="button" class="btn btn-sm btn-primary" name="update-btn">编辑</button>
                        <button type="button" class="btn btn-sm btn-default" name="delete-btn">删除</button>
                    </td>
                </tr>
                </tbody>
                </#list>
            </table>
            <#else>
                <div style="text-align: center;padding-top: 10px">暂无相应数据</div>
            </#if>
            </div>
        <#include "page/paging.ftl" />
        </div>
    </div>
</div>
<input type="hidden" value="/Post/hrmPostManage.html" id="pageUrl">
<div id="hrmContaine">

</div>
<script>
    $(function () {
        var updatebtn = $("button[name='update-btn']");
        updatebtn.click(function () {
            var id = $(this).parents("tr").children("td:nth-child(1)").text();
            $.ajax({
                type: "POST",
                url: "/Post/PostIdInfo.post",
                data: {id: id},
                dataType: "html",
                success: function (data) {
                    jQuery.noConflict();
                    $("#hrmContaine").empty();
                    $("#hrmContaine").append(data);
                    $.openHaiwiModal("popContainer");
                },
                error: function (error) {
                    alert(error);
                }
            })
        });
        //删除职位
        var deletebtn = $("button[name='delete-btn']");
        deletebtn.click(function () {
            var id = $(this).parents("tr").children("td:nth-child(1)").text();
            $.ajax({
                type: "POST",
                url: "/Post/deleteByPostId.post",
                data: {id: id},
                dataType: "html",
                success: function (data) {
                    openView("/Post/hrmPostManage.html");
                },
                error: function (error) {
                    alert(error);
                }
            })
        });
    })
</script>